Declare Function midiOutOpen Lib "mmsystem.dll" (hMidiOut As Integer, ByVal DeviceId As Integer, ByVal C As Long, ByVal I As Long, ByVal F As Long) As Integer
Declare Function midiOutShortMsg Lib "mmsystem.dll" (ByVal hMidiOut As Integer, ByVal midiMessage As Long) As Integer
Declare Function MidiOutClose Lib "mmsystem.dll" (ByVal hMidiOut As Integer) As Integer
Global midiMessageOut As Long
Global midiData1 As Long
Global midiData2 As Long
Global hMidiOut As Integer
' The Patch number array used for current patch for each midi channel
Global midiPatch(16) As Integer
' The Volume array (velocity) used for each MIDI channel
Global midiVolume(16) As Integer
' The Pan array (Left - Center - Right) used for each MIDI channel
Global midiPan(16) As Integer
' The Octave array (piano keys octave shift) used for each MIDI channel
Global octave(16) As Integer
' The current Midi Channel out set on Piano form
Global midiChannelOut As Integer
' NoteRepeat used to stop the same key from repeating.